package com.hq.ims.data.service;

import com.hq.ims.data.dao.AppPushContentMapper;
import com.hq.ims.data.entity.AppPushContent;
import com.hq.mybatis.base.BaseService;
import lombok.NonNull;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * jiang bai ping
 *
 * @Email 526666031@qq.com
 * @Detail APP推送内容服务实现类
 */
@Service
public class BaseAppPushContentService extends BaseService<AppPushContentMapper, AppPushContent> {

    /**
     * @param body   推送内容
     * @param title  推送标题
     * @param extras 自定义Json串
     * @return : void
     * <p>
     * <p>
     * 初始化app推送内容
     */
    @Transactional(rollbackFor = Exception.class)
    public AppPushContent initData(@NonNull String title, @NonNull String body, @NonNull String extras) {
        AppPushContent appPushContent = new AppPushContent();

        //初始化
        appPushContent.setBody(body);
        appPushContent.setTitle(title);
        appPushContent.setExtras(extras);

        appPushContent.insert();

        return appPushContent;
    }
}
